/*
 * @Description: 
 * @Author: yeeChen
 * @Date: 2022-12-21 14:45:06
 * @LastEditTime: 2022-12-21 14:50:21
 * @LastEditors: yeeChen
 */
const express = require('express')
const app = express()

const mw = (req, res, next) => {
    console.log('这是一个局部生效的中间件mw');
    res.time = Date.now()
    next()
}
const mwt = (req, res, next) => {
    console.log('这是一个局部生效的中间件mwt');
    next()
}

app.get('/', mw,mwt, (req, res) => {
    console.log('这是/路由');
    res.send('Home page'+res.time)
})

app.get('/user', (req, res) => {
    console.log('这是/user路由');
    res.send('Home page')
})

app.listen(80, (req, res) => {
    console.log('express running at http://127.0.0.1');
})